package com.woniuxy.rms.dao;

import com.woniuxy.rms.pojo.Permission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PermissionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Permission record);

    int insertSelective(Permission record);

    Permission selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Permission record);

    int updateByPrimaryKey(Permission record);

    @Select("select * from permission")
    List<Permission> findAll();

    /**
     * Description : 分页查询权限  <br/>
     * ChangeLog : 1. 创建 (2020/3/26 0026 上午 9:47 [Administrator]);
     * @param currentPage
     * @param pageSize
     * @return java.util.List<com.woniuxy.rms.pojo.Permission>
    */
    @Select("select permission.*,admin.admin_name from permission left join admin on admin.id = permission.admin_id ")
    List<Permission> findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);

    /**
     * Description : 通过权限名称查找  <br/>
     * ChangeLog : 1. 创建 (2020/3/26 0026 上午 10:27 [Administrator]);
     * @param permission
     * @return com.woniuxy.rms.pojo.Permission
    */
    @Select("select * from permission where permission = #{value}")
    List<Permission> findByPerm(String permission);

    /**
     * Description : 通过id批量删除  <br/>
     * ChangeLog : 1. 创建 (2020/3/26 0026 上午 10:52 [Administrator]);
     * @param permIds
     * @return void
    */
    void batchDelByIds(List<Integer> permIds);
}